Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements a mapper option #6940

Merged
merged 11 commits into from
Oct 22, 2018
Merged

Implements a mapper option #6940

merged 11 commits into from
Oct 22, 2018

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Sep 3, 2018

Summary

This PR allows jest-haste-map to generate additional files that aren't actually baked by the filesystem. The implementation is partial and experimental, since it doesn't remove the virtual files when their source file is being removed (they would have to be linked together in some way).

Test plan

Added a test.

@SimenB
Copy link
Member

SimenB commented Sep 3, 2018

This is failing CI

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing the bigger picture (use case) here, but the code itself looks good :)

@@ -42,6 +42,7 @@ const STRAWBERRY = path.join(FRUITS, 'strawberry.js');
const KIWI = path.join(FRUITS, 'kiwi.js');
const TOMATO = path.join(FRUITS, 'tomato.js');
const MELON = path.join(VEGETABLES, 'melon.json');
const DURIAN = path.join(VEGETABLES, 'durian.zip');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this theme!

@@ -127,6 +127,10 @@ function findNative(
module.exports = function nodeCrawl(
options: CrawlerOptions,
): Promise<InternalHasteMap> {
if (options.mapper) {
throw new Error(`Option 'mapper' isn't supported on this crawler`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Option 'mapper' is not supported in the node crawler"?

@arcanis
Copy link
Contributor Author

arcanis commented Sep 3, 2018

Will fix the tests tomorrow 👍

I'm missing the bigger picture (use case) here

I'm figuring out ways to access the content of zip archives as if they were raw files (without unpacking them). In the case of Jest Haste Map, it requires to fake the existence of those "virtual files" (since Watchman isn't aware about them), so the idea is that the configured mapper will detect such archives and replace them by their directory listing in the haste map.

@arcanis
Copy link
Contributor Author

arcanis commented Oct 3, 2018

@SimenB the travis failure doesn't seem related to my diff, right?

@mjesun mjesun self-requested a review October 22, 2018 14:05
Copy link
Contributor

@mjesun mjesun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants